<?php
class Staticizer_News_Index_Analysis extends Staticizer
{
    public function Build($param=NULL)
    {
        #获取数据
        $data=DB::GetRows('select ID,Thumbnail,Title,Content,Datetime,M_HTMLFile from News where SubclassID='.DAO_NewsClass::SHIPYARD_ANALYSIS_ID.' order by M_IsTop desc,M_IsTop_Datetime desc,Datetime desc limit 0,7');

        #处理数据
        foreach($data as &$row)
        {
            $row['Thumbnail']=Config::PATH_RELATIVE_ATTACHMENT_NEWS.'/'.$row['Thumbnail'];
            $row['M_HTMLFile']=Config::PATH_RELATIVE_CONTENT_NEWS.'/'.$row['M_HTMLFile'];
            if((time()-strtotime($row['Datetime']))/3600/24<3)
                $row['IsNew']='TRUE';
            else
                $row['IsNew']='FALSE';
        }

        #绑定数据
        View::Assign('News_Shipyard_ID',DAO_NewsClass::SHIPYARD_ID);
        View::Assign('News_Shipyard_Analysis_ID',DAO_NewsClass::SHIPYARD_ORDERSHEET_ID);
        View::Assign('News_Subclass_Analysis',@$data);

        #生成静态
        $this->Save('news/index/analysis.html',View::Fetch('news/index/analysis.tpl'));
    }
}
?>